script_info = {
	["title"] = "官方下载通道",
	["version"] = "0.0.3",
	["description"] = "官方APPID",
	["color"] = "#ff8247",
}
     
function onInitTask(task, user, file)
    if task:getType() ~= TASK_TYPE_BAIDU then
        return false
    end
    if user == nil then
        task:setError(-1, "用户未登录")
		return true
	end	
    task:setUris("http://pcs.baidu.com/rest/2.0/pcs/file?method=download&path="..pd.urlEncode(file.path).."&app_id=250528")
    task:setOptions("user-agent", "Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Mobile Safari/537.36")
    task:setOptions("header", "Cookie: "..user:getCookie())
	if user:isSVIP() then
        task:setIcon("icon/accelerate.png", "SVIP加速中！")
	end	
    return true
end